﻿using System;
using System.Collections.Generic;
using System.Text;

namespace RuoTeng.Util.Auth
{
 /// <summary>
 /// 若腾软件常理设置
 /// </summary>
   public static class SoftWareInfo
    {
        //软件相关常量
        public static string skey = "ruoteng8";

        static public string isend;//软件是否过期

        static public string endtime;//过期时间 

        static public string isdemo;

        static public string ver=System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();//获取软件的当前版本

        static public string mc;//机器码

        static public string pid = "2";//软件编号

        

        static public string rthostname = "http://www.ruoteng.cn/rtshop/";//服务器域名

        static public string web_addmc = rthostname+"addmachine.php?pid="+pid+"&machinecode=";//判断机器码存在否

        static public string web_getendtime = rthostname + "getinfo.php?pid=" + pid + "&act=getendtime&machinecode=";//获取到期日期

        static public string web_isend  = rthostname + "getinfo.php?pid=" + pid + "&act=isend&machinecode=";//查看是否到期

        static public string web_isdemo = rthostname + "getinfo.php?pid=" + pid + "&act=isdemo&machinecode=";//查看是否试用版

        static public string web_status = rthostname + "getinfo.php?pid=" + pid + "&act=status&machinecode=";//查看是否到期

        static public string web_newver = rthostname + "getinfo.php?pid=" + pid + "&act=ver";//查看最新版本

        static public string web_updatelog=rthostname + "getinfo.php?pid=" + pid + "&act=updatelog";//查看软件公告

        static public bool FisrtGetServer = true;

        static public string GetData(string url)
        {
            string data = "";
            try
            {
                System.Net.HttpWebRequest myHttpWebRequest   = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
                myHttpWebRequest.Timeout = 30000;
                System.Net.HttpWebResponse myHttpWebResponse = (System.Net.HttpWebResponse)myHttpWebRequest.GetResponse();
                System.IO.Stream myResponseStream = myHttpWebResponse.GetResponseStream();
                System.IO.StreamReader myStreamReader = new System.IO.StreamReader(myResponseStream, Encoding.GetEncoding("utf-8"));
                data = myStreamReader.ReadToEnd();
            }
            catch (Exception e)
            {
                throw e;
            }
            return data;
        }

    }
}
